﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Viewer.BusinessObject.BusinessEntities;
using Ext.Net;

namespace Viewer.PhanQuyen
{
    public partial class PagePhanQuyenByToChuc : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindData_NhomQuyenByToChuc();
            }
        }

        public void BindData_NhomQuyenByToChuc()
        {
            var oQUNhomQuyenByToChuc = new QUNhomQuyenByToChuc();
            storeQUNhomQuyenByToChuc.DataSource = oQUNhomQuyenByToChuc.GetAllWithCurrentUserOwner();
            storeQUNhomQuyenByToChuc.DataBind();
        }

        [DirectMethod]
        public void ShowDialog_QUNhomQuyenByToChuc_Detail(int pQUNhomQuyenByToChucId)
        {
            ucNhomQuyenByToChuc.ShowDetailDialog(pQUNhomQuyenByToChucId);
        }
        [DirectMethod]
        public void ShowDialog_QUNhomQuyenByToChuc_Edit(int pNhomQuyenByToChucId, string pTenNhomQuyenByToChuc, string pGhiChu)
        {
            ucNhomQuyenByToChuc.ShowEditDialog(pNhomQuyenByToChucId);
        }

        protected void ShowDialog_QUNhomQuyenByToChuc_AddNew(object sender, DirectEventArgs e)
        {
            ucNhomQuyenByToChuc.ShowAddNewDialog();
        }

        [DirectMethod]
        public void NhomQuyenByToChuc_Delete(int pNhomQuyenByToChucId)
        {
            QUNhomQuyenByToChuc oItem = new QUNhomQuyenByToChuc();
            oItem = oItem.GetById(pNhomQuyenByToChucId);
            oItem.Delete();
            BindData_NhomQuyenByToChuc();
        }
        
    }
}
